// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/cupertino.dart';
import 'package:cookie_jar/cookie_jar.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_program/fragment_five/StaticList.dart';
import 'package:flutter_program/fragment_five/bean/FiveBaseBean.dart';
import 'package:flutter_program/fragment_five/bean/SparePartEntities.dart';
import 'package:flutter_program/fragment_five/bean/UserListBean.dart';
import 'package:flutter_program/fragment_five/view/FragmentXunJianPagerItem1.dart';
import 'package:flutter_program/fragment_five/view/FragmentXunJianPagerItem2.dart';
import 'package:flutter_program/fragment_five/view/TimeGetPager.dart';
import 'package:flutter_program/fragment_five/view/XunJianPager.dart';
import 'package:flutter_program/fragment_five/view/date_and_time_picker_demo.dart';
import 'package:flutter_program/fragment_five/view/date_and_time_picker_demo_AddPerson.dart';
import 'package:flutter_program/fragment_five/view/date_and_time_picker_demo_end.dart';
import 'package:flutter_program/fragment_five/view/pickture_selected/PicktureSelectedPager.dart';
import 'package:flutter_program/fragment_six/bean/AlreadyAplayBean.dart';
import 'package:flutter_program/fragment_six/view/FaultRepairPager.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:percent_indicator/percent_indicator.dart';

// Each TabBarView contains a _Page and for each _Page there is a list
// of _CardData objects. Each _CardData object is displayed by a _CardItem.

class FragmentXunJian extends StatefulWidget {
  FiveBaseBean bean;

  FragmentXunJian(FiveBaseBean bean) {
    this.bean = bean;
  }

  @override
  _FragmentXunJianState createState() => new _FragmentXunJianState(this.bean);
}

class Prisize extends StatefulWidget implements PreferredSizeWidget {
  var child;

  @override
  State<StatefulWidget> createState() {
    return _StatePriseze(this.child);
  }

  // TODO: implement preferredSize
  @override
  Size get preferredSize => null;
}

class _StatePriseze extends State<Prisize> {
  var child;

  _StatePriseze(this.child);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      child: child,
    );
  }
}

class _FragmentXunJianState extends State<FragmentXunJian> {
  FiveBaseBean bean;
  var _switchValue = false;

  String shijiStart_Time = "";

  String ShijiEndTime = "";

  String picktureNumber;

  var newNumber = new TextEditingController();
  var newNumber1 = new TextEditingController();
  var newNumber2 = new TextEditingController();

  _FragmentXunJianState(this.bean);

  List<String> choices = new List();
  List<AlreadyAplayBean> dataAlready = new List();
  List<UserListBean> result = new List();
  List<SparePartEntities> result1 = new List();
  GlobalKey _myKey = new GlobalKey();

  @override
  void initState() {
    super.initState();
    print('是么');
    setState(() {
      StaticList.images.clear();
      picktureNumber = StaticList.images.length.toString();
      choices.add('工单信息');
      choices.add('工作量');
      choices.add('更换派件');
    });
  }

  _showDialog(var index) {
    showDialog<Null>(
      context: context,
      child: new AlertDialog(
          content: new Container(
            margin: new EdgeInsets.only(top: 10.0),
            alignment: Alignment.center,
            height: 240.0,
            width: MediaQuery.of(context).size.width,
            child: Container(
              color: Colors.white,
              child: Column(
                children: <Widget>[
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Container(
                        color: Colors.white,
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              children: <Widget>[
                                Container(
                                  margin: EdgeInsets.only(left: 2.0, top: 1.0),
                                  child: Text(
                                    result1[index].name,
                                    style: TextStyle(
                                        fontSize: 16.0,
                                        color: Colors.lightBlueAccent,
                                        fontWeight: FontWeight.w400),
                                  ),
                                ),
                              ],
                            ),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              children: <Widget>[
                                Container(
                                  margin: EdgeInsets.only(left: 2.0, top: 8.0),
                                  child: Text('备件编号:'),
                                ),
                                Container(
                                  margin: new EdgeInsets.only(top: 8.0),
                                  child: Text(
                                    result1[index].number,
                                    style: TextStyle(fontSize: 16.0),
                                  ),
                                ),
                              ],
                            ),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.start,
                              children: <Widget>[
                                Container(
                                  margin: EdgeInsets.only(left: 2.0, top: 8.0),
                                  child: Text('规格型号:'),
                                ),
                                Container(
                                  margin: new EdgeInsets.only(top: 8.0),
                                  child: Text(
                                    result1[index].specModels,
                                    style: TextStyle(fontSize: 16.0),
                                  ),
                                ),
                              ],
                            ),
                            Row(
                              children: <Widget>[
                                Container(
                                  margin: EdgeInsets.only(left: 2.0, top: 8.0),
                                  child: Text('当前库存:' +
                                      result1[index].currRepertory.toString()),
                                ),
                                Text(""),
                              ],
                            ),
                            Container(
                              margin: new EdgeInsets.only(top: 5.0),
                              child: Row(
                                children: <Widget>[
                                  Container(
                                    margin:
                                        EdgeInsets.only(left: 2.0, top: 8.0),
                                    child: Text('原配件序列:'),
                                  ),
                                  new SizedBox(
                                    height:30.0,
                                    width: 90.0,
                                    child: Container(
                                      margin: new EdgeInsets.only(
                                          left: 1.0, right: 1.0, top: 0.0),
                                      height: 25.0,
                                      decoration: BoxDecoration(
                                        color: Colors.transparent,
                                        border:
                                            Border.all(color: Colors.black12),
                                        borderRadius: BorderRadius.all(
                                          const Radius.circular(6.0),
                                        ),
                                      ),
                                      child: new TextField(
                                        keyboardType: TextInputType.text,
                                        cursorWidth: 1.5,
                                        cursorColor: Colors.lightBlueAccent,
                                        style: TextStyle(color: Colors.black38),
                                        controller: newNumber,
                                        decoration: new InputDecoration(
                                            labelStyle: TextStyle(
                                                color: Colors.black12,
                                                fontWeight: FontWeight.bold,
                                                fontSize: 12.0),
                                            hintText: "请输入",
                                            focusedBorder: InputBorder.none,
                                            border: InputBorder.none,
                                            hintStyle: TextStyle(
                                                fontSize: 11.0,
                                                color: Colors.black12,
                                                fontWeight: FontWeight
                                                    .w100)), //FontWeight.w400
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              margin: new EdgeInsets.only(top: 6.0),
                              child: Row(
                                children: <Widget>[
                                  Container(
                                    margin:
                                        EdgeInsets.only(left: 2.0, top: 5.0),
                                    child: Text('新换上序号:'),
                                  ),
                                  new SizedBox(
                                    height:30.0,
                                    width: 90.0,
                                    child: Container(
                                      margin: new EdgeInsets.only(
                                          left: 1.0, right: 1.0, top: 0.0),
                                      height: 25.0,
                                      decoration: BoxDecoration(
                                        color: Colors.transparent,
                                        border:
                                            Border.all(color: Colors.black12),
                                        borderRadius: BorderRadius.all(
                                          const Radius.circular(6.0),
                                        ),
                                      ),
                                      child: new TextField(
                                        keyboardType: TextInputType.text,
                                        cursorWidth: 1.5,
                                        cursorColor: Colors.lightBlueAccent,
                                        style: TextStyle(color: Colors.black38),
                                        controller: newNumber1,
                                        decoration: new InputDecoration(
                                            labelStyle: TextStyle(
                                                color: Colors.black12,
                                                fontWeight: FontWeight.bold,
                                                fontSize: 9.0),
                                            hintText: "请输入",
                                            focusedBorder: InputBorder.none,
                                            border: InputBorder.none,
                                            hintStyle: TextStyle(
                                              fontSize: 11.0,
                                              color: Colors.black12,
                                            )), //FontWeight.w400
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              margin: new EdgeInsets.only(top: 6.0),
                              child: Row(
                                children: <Widget>[
                                  Container(
                                    margin:
                                        EdgeInsets.only(left: 2.0, top: 5.0),
                                    child: Text('数量:'),
                                  ),
                                  new SizedBox(
                                    height: 30.0,
                                    width: 90.0,
                                    child: Container(
                                      padding: new EdgeInsets.only(bottom:9.0),
                                      margin: new EdgeInsets.only(
                                          left: 1.0, right: 1.0, top: 0.0),
                                      height: 25.0,
                                      decoration: BoxDecoration(
                                        color: Colors.transparent,
                                        border:
                                            Border.all(color: Colors.black12),
                                        borderRadius: BorderRadius.all(
                                          const Radius.circular(6.0),
                                        ),
                                      ),
                                      child: Container(
                                        padding: new EdgeInsets.only(bottom:9.0),child:new TextField(
                                        keyboardType: TextInputType.text,
                                        cursorWidth: 1.5,
                                        cursorColor: Colors.lightBlueAccent,
                                        style: TextStyle(color: Colors.black38),
                                        controller: newNumber2,
                                        decoration: new InputDecoration(
                                            labelStyle: TextStyle(
                                                color: Colors.black12,
                                                fontWeight: FontWeight.bold,
                                                fontSize: 12.0),
                                            hintText: "请输入",
                                            focusedBorder: InputBorder.none,
                                            border: InputBorder.none,
                                            hintStyle: TextStyle(
                                              fontSize: 9.0,
                                              color: Colors.black12,
                                            )), //FontWeight.w400
                                      ),),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              margin: new EdgeInsets.only(top: 6.0),
                              height: 10.0,
                              color: Colors.black12,
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
          actions: <Widget>[
            Container(
                width: MediaQuery.of(context).size.width - 96.0,
                child: Column(
                  children: <Widget>[
                    Container(
                      width: MediaQuery.of(context).size.width - 96.0,
                      color: Colors.black12,
                      height: 1.0,
                    ),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      children: <Widget>[
                        new FlatButton(
                          onPressed: () {
                            Navigator.pop(context);
                            //SystemNavigator.pop();
                          },
                          child: new Text('关闭'),
                        ),
                        Container(
                          width: 1.0,
                          color: Colors.black12,
                          height: 40.0,
                        ),
                        new FlatButton(
                          onPressed: () {
                            Navigator.pop(context);
                          },
                          child: Text("保存"),
                        ),
                      ],
                    ),
                  ],
                )),
          ]),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
        title: 'Flutter Demo',
        theme: new ThemeData(
            indicatorColor: Colors.blue, primaryColor: Colors.white),
        home: new Scaffold(
          appBar: new AppBar(
            leading: InkWell(
              onTap: () {
                Navigator.of(context).pop();
              }, //故障申请表
              child: Icon(
                Icons.chevron_left,
                size: 29.0,
                color: Colors.white,
              ),
            ),
            backgroundColor: Colors.blue,
            title: Text(
              bean.name + "保养",
              style: TextStyle(color: Colors.white, fontSize: 16.0),
            ),
            actions: <Widget>[
              Center(
                child: Padding(
                  padding: new EdgeInsets.only(right: 20.0),
                  child: Text(
                    '提交',
                    style: TextStyle(color: Colors.white, fontSize: 14.0),
                  ),
                ),
              )
            ],
            centerTitle: true,
            elevation: 0.0,
          ),
          body: new DefaultTabController(
            length: choices.length,
            child: new Scaffold(
              appBar: PreferredSize(
                preferredSize: Size.fromHeight(40.0),
                child: Container(
                  color: Colors.white,
                  child: new TabBar(
                    indicatorPadding: EdgeInsets.all(0.0),
                    indicatorColor: Colors.blue,
                    isScrollable: true,
                    labelColor: Colors.blue,
                    unselectedLabelColor: Colors.black,
                    tabs: choices.map((String choice) {
                      return new Container(
                        height: 40.0,
                        width: MediaQuery.of(context).size.width / 3 - 30,
                        child: new Tab(
                          text: choice,
                        ),
                      );
                    }).toList(),
                  ),
                ),
              ),
              body: new TabBarView(
                key: new Key('Home Page'),
                children: choices.map((String choice) {
                  return choice == '工单信息'
                      ? new Stack(
                          alignment: Alignment.bottomCenter,
                          children: <Widget>[
                            SizedBox(
                              width: MediaQuery.of(context).size.width,
                              height: MediaQuery.of(context).size.height,
                              child: ListView.builder(
                                itemCount: 1,
                                itemBuilder: (context, index) {
                                  return InkWell(
                                    child: Column(
                                      children: <Widget>[
                                        Container(
                                          height: 10.0,
                                          color: Colors.black12,
                                          width:
                                              MediaQuery.of(context).size.width,
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("设备编号"),
                                                  ),
                                                  Text(bean.name),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("设备类型"),
                                                  ),
                                                  Text(bean.equipmentTypeName),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("规格型号"),
                                                  ),
                                                  Text(bean.specModels),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("所在部门"),
                                                  ),
                                                  Text(bean.deptName),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("接收人"),
                                                  ),
                                                  Text(bean.operationStaff),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("设备编号"),
                                                  ),
                                                  Text(bean.number),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("安装地点"),
                                                  ),
                                                  Text(bean.installationSite),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("包养级别"),
                                                  ),
                                                  Text(bean
                                                      .routingInspectionLevelName),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("是否停机"),
                                                  ),
                                                  new CupertinoSwitch(
                                                    value: _switchValue,
                                                    onChanged: (bool value) {
                                                      setState(() {
                                                        _switchValue = value;
                                                      });
                                                    },
                                                  ),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("停机时长"),
                                                  ),
                                                  Text('0.0'),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        InkWell(
                                          onTap: () {
                                            //设备管理
                                            Navigator.of(context).push(
                                                new PageRouteBuilder(
                                              pageBuilder:
                                                  (BuildContext context, _,
                                                      __) {
                                                return new PicktureSelectedPager();
                                              },
                                            )).then((vlue) => setState(() {
                                                  picktureNumber = StaticList
                                                      .images.length
                                                      .toString();
                                                }));
                                          },
                                          child: Column(
                                            children: <Widget>[
                                              Container(
                                                height: 41.0,
                                                child: Row(
                                                  children: <Widget>[
                                                    Container(
                                                      padding:
                                                          new EdgeInsets.only(
                                                              left: 20.0,
                                                              right: 80.0),
                                                      child: Text("保养图片"),
                                                    ),
                                                    Text(StaticList
                                                            .images.length
                                                            .toString() +
                                                        '张'),
                                                  ],
                                                ),
                                              ),
                                              Container(
                                                width: MediaQuery.of(context)
                                                    .size
                                                    .width,
                                                color: Colors.black26,
                                                height: 1.0,
                                              )
                                            ],
                                          ),
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 80.0),
                                                    child: Text("检查项目"),
                                                  ),
                                                  Text(""),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 10.0),
                                                    child: Text("检查项目进度"),
                                                  ),
                                                  Container(
                                                    margin: new EdgeInsets.only(
                                                      left: 40.0,
                                                    ),
                                                    width: 160.0,
                                                    child:
                                                        new LinearPercentIndicator(
                                                      width: 150.0,
                                                      lineHeight: 4.0,
                                                      percent: 0.9,
                                                      progressColor:
                                                          Colors.blue,
                                                    ),
                                                  ),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 50.0),
                                                    child: Text("计划开始时间"),
                                                  ),
                                                  InkWell(
                                                    child: Text(
                                                        bean.planStartTime),
                                                    onTap: () {
                                                      //设备管理
                                                      Navigator.of(context).push(
                                                          new PageRouteBuilder(
                                                        pageBuilder:
                                                            (BuildContext
                                                                    context,
                                                                _,
                                                                __) {
                                                          return new DateAndTimePickerDemo();
                                                        },
                                                      )).then((vlue) =>
                                                          setState(() {}));
                                                    },
                                                  ),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        Column(
                                          children: <Widget>[
                                            Container(
                                              height: 41.0,
                                              child: Row(
                                                children: <Widget>[
                                                  Container(
                                                    padding:
                                                        new EdgeInsets.only(
                                                            left: 20.0,
                                                            right: 50.0),
                                                    child: Text("计划结束时间"),
                                                  ),
                                                  Text(bean.planEndTime),
                                                ],
                                              ),
                                            ),
                                            Container(
                                              width: MediaQuery.of(context)
                                                  .size
                                                  .width,
                                              color: Colors.black26,
                                              height: 1.0,
                                            )
                                          ],
                                        ),
                                        InkWell(
                                          onTap: () {
                                            //设备管理
                                            Navigator.of(context).push(
                                                new PageRouteBuilder(
                                              pageBuilder:
                                                  (BuildContext context, _,
                                                      __) {
                                                return new DateAndTimePickerDemo();
                                              },
                                            )).then((vlue) => setState(() {
                                                  shijiStart_Time =
                                                      StaticList.ShijiStartTime;
                                                }));
                                          },
                                          child: Column(
                                            //备件列表
                                            children: <Widget>[
                                              Container(
                                                height: 41.0,
                                                child: Row(
                                                  children: <Widget>[
                                                    Container(
                                                      padding:
                                                          new EdgeInsets.only(
                                                              left: 20.0,
                                                              right: 50.0),
                                                      child: Text("实际开始时间"),
                                                    ),
                                                    Row(
                                                      mainAxisAlignment:
                                                          MainAxisAlignment
                                                              .spaceEvenly,
                                                      children: <Widget>[
                                                        Container(
                                                          width: 130.0,
                                                          child: Text(
                                                              shijiStart_Time),
                                                        ),
                                                        Container(
                                                            margin:
                                                                new EdgeInsets
                                                                        .only(
                                                                    left: 50.0),
                                                            child: Image.asset(
                                                              "images/mipmap-xhdpi-v4/gteq_icon_main_go.png",
                                                              height: 15.0,
                                                              width: 18.0,
                                                            )),
                                                      ],
                                                    ),
                                                  ],
                                                ),
                                              ),
                                              Container(
                                                width: MediaQuery.of(context)
                                                    .size
                                                    .width,
                                                color: Colors.black26,
                                                height: 1.0,
                                              )
                                            ],
                                          ),
                                        ),
                                        InkWell(
                                          onTap: () {
                                            //设备管理
                                            Navigator.of(context).push(
                                                new PageRouteBuilder(
                                              pageBuilder:
                                                  (BuildContext context, _,
                                                      __) {
                                                return new DateAndTimePickerDemoEnd();
                                              },
                                            )).then((vlue) => setState(() {
                                                  ShijiEndTime =
                                                      StaticList.ShijiEndTime;
                                                }));
                                          },
                                          child: Column(
                                            children: <Widget>[
                                              Container(
                                                height: 41.0,
                                                child: Row(
                                                  children: <Widget>[
                                                    Container(
                                                      padding:
                                                          new EdgeInsets.only(
                                                              left: 20.0,
                                                              right: 50.0),
                                                      child: Text("实际完成时间"),
                                                    ),
                                                    Row(
                                                      mainAxisAlignment:
                                                          MainAxisAlignment
                                                              .spaceEvenly,
                                                      children: <Widget>[
                                                        Container(
                                                          width: 130.0,
                                                          child: Text(
                                                              ShijiEndTime),
                                                        ),
                                                        Container(
                                                            margin:
                                                                new EdgeInsets
                                                                        .only(
                                                                    left: 50.0),
                                                            child: Image.asset(
                                                              "images/mipmap-xhdpi-v4/gteq_icon_main_go.png",
                                                              height: 15.0,
                                                              width: 18.0,
                                                            )),
                                                      ],
                                                    ),
                                                  ],
                                                ),
                                              ),
                                              Container(
                                                width: MediaQuery.of(context)
                                                    .size
                                                    .width,
                                                color: Colors.black26,
                                                height: 0.0,
                                              )
                                            ],
                                          ),
                                        ),
                                        Container(
                                          height: 41.0,
                                        ),
                                      ],
                                    ),
                                  );
                                },
                              ),
                            ),
                            new Container(
                              height: 35.0,
                              width: MediaQuery.of(context).size.width,
                              color: Color.fromRGBO(45, 46, 55, 22.0),
                              child: Center(
                                child: Text(
                                  "保存",
                                  style: TextStyle(color: Colors.white),
                                ),
                              ),
                            )
                          ],
                        )
                      : choice == '工作量'
                          ? Container(
                              margin: new EdgeInsets.only(top: 10.0),
                              color: Colors.black12,
                              child: Stack(
                                children: <Widget>[
                                  new InkWell(
                                    onTap: () {
                                      //设备管理
                                      Navigator.of(context).push(
                                          new PageRouteBuilder(
                                        pageBuilder:
                                            (BuildContext context, _, __) {
                                          return new FragmentXunJianPagerItem1();
                                        },
                                      )).then((vlue) => setState(() {
                                            result.clear();
                                            for (int i = 0;
                                                i < StaticList.mdataUser.length;
                                                i++) {
                                              if (StaticList
                                                  .mdataUser[i].isSelected) {
                                                result.add(
                                                    StaticList.mdataUser[i]);
                                                print(StaticList
                                                    .mdataUser[i].fullname);
                                              }
                                            }
                                          }));
                                    },
                                    child: Container(
                                      margin: new EdgeInsets.only(bottom: 45.0),
                                      height: 43.0,
                                      color: Colors.white,
                                      child: Row(
                                        mainAxisAlignment:
                                            MainAxisAlignment.center,
                                        children: <Widget>[
                                          Icon(
                                            Icons.add,
                                            color: Colors.blue,
                                          ),
                                          Text(
                                            '增加人员',
                                            style:
                                                TextStyle(color: Colors.blue),
                                          ),
                                        ],
                                      ),
                                    ),
                                  ),
                                  Container(
                                    margin: EdgeInsets.only(top: 50.0),
                                    child: ListView.builder(
                                        itemCount: result.length,
                                        itemBuilder:
                                            (BuildContext context, index) {
                                          return InkWell(
                                            onTap: () {
                                              //设备管理
                                              Navigator.of(context)
                                                  .push(new PageRouteBuilder(
                                                pageBuilder:
                                                    (BuildContext context, _,
                                                        __) {
                                                  //点击之后进行对当前item所对应的对象进行处理，主要是给时间进行复制。然后
                                                  StaticList.resultAddPerson =
                                                      result; //这里作为存储时间的集合，过来之后进行删除result//然后进行复制resultAddPerson这个就可以啦
                                                  return new DateAndTimePickerDemoAddPerson(
                                                      index);
                                                },
                                              )).then((vlue) => setState(() {
                                                        //这里选择时间之后需要更新result因为
                                                        // result.clear();
                                                        result = StaticList
                                                            .resultAddPerson;
                                                      }));
                                            },
                                            child: Container(
                                                color: Colors.white,
                                                child: Column(
                                                  children: <Widget>[
                                                    Row(
                                                      mainAxisAlignment:
                                                          MainAxisAlignment
                                                              .spaceBetween,
                                                      children: <Widget>[
                                                        //TODO 这里修改
                                                        Column(
                                                          crossAxisAlignment:
                                                              CrossAxisAlignment
                                                                  .start,
                                                          children: <Widget>[
                                                            Row(
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          10.0,
                                                                      top:
                                                                          10.0),
                                                                  child: Image
                                                                      .asset(
                                                                    'images/mipmap-xhdpi-v4/gteq_head_portrait.png',
                                                                    height:
                                                                        27.0,
                                                                    width: 27.0,
                                                                  ),
                                                                ),
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          10.0,
                                                                      top:
                                                                          10.0),
                                                                  child: Text(
                                                                    result[index]
                                                                        .fullname,
                                                                    style: TextStyle(
                                                                        fontSize:
                                                                            16.0),
                                                                  ),
                                                                ),
                                                              ],
                                                            ),
                                                            Row(
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          50.0,
                                                                      top: 8.0),
                                                                  child: Text(
                                                                      '维修开始时间:'),
                                                                ),
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          10.0,
                                                                      top:
                                                                          10.0),
                                                                  child: Text(
                                                                    result[index]
                                                                        .WinxiuStartTime,
                                                                    style: TextStyle(
                                                                        fontSize:
                                                                            16.0),
                                                                  ),
                                                                ),
                                                              ],
                                                            ),
                                                            Row(
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          50.0,
                                                                      top: 8.0),
                                                                  child: Text(
                                                                      '维修完成时间:'),
                                                                ),
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          10.0,
                                                                      top:
                                                                          10.0),
                                                                  child: Text(
                                                                    result[index]
                                                                        .WinxiuEndTime,
                                                                    style: TextStyle(
                                                                        fontSize:
                                                                            16.0),
                                                                  ),
                                                                ),
                                                              ],
                                                            ),
                                                            Row(
                                                              mainAxisAlignment:
                                                                  MainAxisAlignment
                                                                      .start,
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          50.0,
                                                                      top: 8.0),
                                                                  child: Text(
                                                                      '维修时间:'),
                                                                ),
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          10.0,
                                                                      top:
                                                                          10.0),
                                                                  child: Text(
                                                                    result[index]
                                                                        .AlwaysTime,
                                                                    style: TextStyle(
                                                                        fontSize:
                                                                            16.0),
                                                                  ),
                                                                ),
                                                              ],
                                                            ),
                                                            Container(
                                                              margin:
                                                                  new EdgeInsets
                                                                          .only(
                                                                      top:
                                                                          16.0),
                                                              height: 10.0,
                                                              color: Colors
                                                                  .black12,
                                                            ),
                                                          ],
                                                        ),
                                                        //TODO 删除按钮
                                                        InkWell(
                                                          onTap: () {
                                                            setState(() {
                                                              UserListBean
                                                                  addchild =
                                                                  result[index];
                                                              result.remove(
                                                                  addchild);
                                                            });
                                                          },
                                                          child: Container(
                                                            margin:
                                                                new EdgeInsets
                                                                        .only(
                                                                    right:
                                                                        20.0),
                                                            child: Icon(
                                                              Icons
                                                                  .delete_forever,
                                                              size: 30.0,
                                                              color: Colors.red,
                                                            ),
                                                          ),
                                                        ),
                                                      ],
                                                    ),
                                                    Container(
                                                      color: Colors.black12,
                                                      height: 1.0,
                                                      width:
                                                          MediaQuery.of(context)
                                                              .size
                                                              .width,
                                                    ),
                                                  ],
                                                )),
                                          );
                                        }),
                                  ),
                                ],
                              ),
                            ) //todo
                          : Container(
                              margin: new EdgeInsets.only(top: 10.0),
                              color: Colors.black12,
                              child: Stack(
                                children: <Widget>[
                                  new InkWell(
                                    onTap: () {
                                      //设备管理
                                      Navigator.of(context)
                                          .push(new PageRouteBuilder(
                                        pageBuilder:
                                            (BuildContext context, _, __) {
                                          return new FragmentXunJianPagerItem2();
                                        },
                                      )).then((vlue) => setState(() {
                                                result1.clear();
                                                for (int i = 0;
                                                    i <
                                                        StaticList.mPaijianData1
                                                            .length;
                                                    i++) {
                                                  if (StaticList
                                                      .mPaijianData1[i]
                                                      .isSelected) {
                                                    result1.add(StaticList
                                                        .mPaijianData1[i]);
                                                  }
                                                }
                                              }));
                                    },
                                    child: Container(
                                      margin: new EdgeInsets.only(bottom: 45.0),
                                      height: 43.0,
                                      color: Colors.white,
                                      child: Row(
                                        mainAxisAlignment:
                                            MainAxisAlignment.center,
                                        children: <Widget>[
                                          Icon(
                                            Icons.add,
                                            color: Colors.blue,
                                          ),
                                          Text(
                                            '增加配件',
                                            style:
                                                TextStyle(color: Colors.blue),
                                          ),
                                        ],
                                      ),
                                    ),
                                  ),
                                  Container(
                                    margin: EdgeInsets.only(top: 50.0),
                                    child: ListView.builder(
                                        itemCount: result1.length,
                                        itemBuilder:
                                            (BuildContextcontext, index) {
                                          return Container(
                                            color: Colors.white,
                                            child: Column(
                                              children: <Widget>[
                                                Row(
                                                  mainAxisAlignment:
                                                      MainAxisAlignment
                                                          .spaceBetween,
                                                  children: <Widget>[
                                                    InkWell(
                                                      onTap: () {
                                                        _showDialog(index);
                                                      },
                                                      child: Container(
                                                        color: Colors.white,
                                                        child: Column(
                                                          crossAxisAlignment:
                                                              CrossAxisAlignment
                                                                  .start,
                                                          children: <Widget>[
                                                            Row(
                                                              mainAxisAlignment:
                                                                  MainAxisAlignment
                                                                      .start,
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          30.0,
                                                                      top:
                                                                          10.0),
                                                                  child: Text(
                                                                    result1[index]
                                                                        .name,
                                                                    style: TextStyle(
                                                                        fontSize:
                                                                            16.0),
                                                                  ),
                                                                ),
                                                              ],
                                                            ),
                                                            Row(
                                                              mainAxisAlignment:
                                                                  MainAxisAlignment
                                                                      .start,
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          30.0,
                                                                      top: 8.0),
                                                                  child: Text(
                                                                      '备件编号:'),
                                                                ),
                                                                Text(
                                                                  result1[index]
                                                                      .number,
                                                                  style: TextStyle(
                                                                      fontSize:
                                                                          16.0),
                                                                ),
                                                              ],
                                                            ),
                                                            Row(
                                                              mainAxisAlignment:
                                                                  MainAxisAlignment
                                                                      .start,
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          30.0,
                                                                      top: 8.0),
                                                                  child: Text(
                                                                      '规格型号:'),
                                                                ),
                                                                Text(
                                                                  result1[index]
                                                                      .specModels,
                                                                  style: TextStyle(
                                                                      fontSize:
                                                                          16.0),
                                                                ),
                                                              ],
                                                            ),
                                                            Row(
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          30.0,
                                                                      top: 8.0),
                                                                  child: Text('库存数量:' +
                                                                      result1[index]
                                                                          .currRepertory
                                                                          .toString()),
                                                                ),
                                                                Text(""),
                                                              ],
                                                            ),
                                                            Row(
                                                              children: <
                                                                  Widget>[
                                                                Container(
                                                                  margin: EdgeInsets.only(
                                                                      left:
                                                                          30.0,
                                                                      top: 8.0),
                                                                  child: Text('更换数量:' +
                                                                      result1[index]
                                                                          .delFlag
                                                                          .toString()),
                                                                ),
                                                                Text(""),
                                                              ],
                                                            ),
                                                            Container(
                                                              margin:
                                                                  new EdgeInsets
                                                                          .only(
                                                                      top:
                                                                          16.0),
                                                              height: 10.0,
                                                              color: Colors
                                                                  .black12,
                                                            ),
                                                          ],
                                                        ),
                                                      ),
                                                    ),
                                                    //TODO
                                                    //TODO 删除按钮
                                                    InkWell(
                                                      onTap: () {
                                                        setState(() {
                                                          SparePartEntities
                                                              addchild =
                                                              result1[index];
                                                          //而且将主列表数据不让记录下来
                                                          for (int i = 0;
                                                              i <
                                                                  StaticList
                                                                      .mPaijianData1
                                                                      .length;
                                                              i++) {
                                                            if (StaticList
                                                                        .mPaijianData1[
                                                                    i] ==
                                                                result1[
                                                                    index]) {
                                                              StaticList
                                                                  .mPaijianData1[
                                                                      i]
                                                                  .isSelected = false;
                                                            }
                                                          }
                                                          result1
                                                              .remove(addchild);
                                                        });
                                                      },
                                                      child: Container(
                                                        margin:
                                                            new EdgeInsets.only(
                                                                right: 20.0),
                                                        child: Icon(
                                                          Icons.delete_forever,
                                                          size: 30.0,
                                                          color: Colors.red,
                                                        ),
                                                      ),
                                                    ),
                                                  ],
                                                ),
                                                Container(
                                                  height: 1.0,
                                                  width: MediaQuery.of(context)
                                                      .size
                                                      .width,
                                                  color: Colors.black12,
                                                ),
                                              ],
                                            ),
                                          );
                                        }),
                                  ),
                                ],
                              ),
                            );
                }).toList(),
              ),
            ),
          ),
        ));
  }
}
